function dump()
{
    var s = "";

    for (i in arguments) {
        s += arguments[i];
    }

    // s += "<br />";

    // document.write(s);
    console.log(s);
}


var xhttp = null;

function ajax_get(url)
{
    xhttp.open("GET", url);
    xhttp.send();
}

function init()
{
    xhttp = new XMLHttpRequest();
    var content = document.querySelector(".content");

    xhttp.onreadystatechange = function() {
        var data = "请求失败, 请重试!";
        if (xhttp.readyState == 4 && xhttp.status == 200) {
            data = xhttp.responseText;
        }
        content.innerHTML = data;
    };


    var btn = document.querySelector(".get");
    btn.addEventListener("click", function(){
        ajax_get("weather.php?name=" + document.querySelector(".input").value);
        // 请求静态页面会直接将页面内容发送回来
        // ajax_get("index.html");
    });
}

init();



